import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from '@cool-midway/core';
import { Column, Index } from 'typeorm';

/**
 * 系统日志
 */
@EntityModel('user_action_log')
export class UserActionLogEntity extends BaseEntity {
  @Index()
  @Column({
    comment: '用户ID',
    name: 'user_id',
    nullable: true,
    type: 'bigint',
  })
  userId: number;

  @Index()
  @Column({ comment: '行为', length: 100 })
  action: string;

  @Index()
  @Column({ comment: 'ip', nullable: true, length: 50 })
  ip: string;

  @Index()
  @Column({ comment: 'ip地址', name: 'ip_addr', nullable: true, length: 50 })
  ipAddr: string;

  @Column({ comment: '参数', nullable: true, type: 'text' })
  params: string;
}
